<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.8">
<title>Building the Project</title>
<link rel="stylesheet" href="css/spring.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body class="article toc2 toc-left">
<div id="header">
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#building-the-project">Building the Project</a>
<ul class="sectlevel2">
<li><a href="#building-project-setup">Project Setup</a></li>
<li><a href="#building-prerequisites">Prerequisites</a></li>
<li><a href="#building-bats-submodules">Bats Submodules</a></li>
<li><a href="#building-build-and-test">Build and test</a></li>
<li><a href="#building-generate-documentation">Generate Documentation</a></li>
</ul>
</li>
<li><a href="#building-ci-worker-prerequisites">CI Server Worker Prerequisites</a></li>
</ul>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="building-the-project"><a class="link" href="#building-the-project">Building the Project</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>This section covers how to build the project. It covers:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="#building-project-setup">Project Setup</a></p>
</li>
<li>
<p><a href="#building-prerequisites">Prerequisites</a></p>
</li>
<li>
<p><a href="#building-bats-submodules">Bats Submodules</a></p>
</li>
<li>
<p><a href="#building-build-and-test">Build and test</a></p>
</li>
<li>
<p><a href="#building-generate-documentation">Generate Documentation</a></p>
</li>
<li>
<p><a href="#building-ci-worker-prerequisites">CI Server Worker Prerequisites</a></p>
</li>
</ul>
</div>
<div class="sect2">
<h3 id="building-project-setup"><a class="link" href="#building-project-setup">Project Setup</a></h3>
<div class="paragraph">
<p>The project contains the following structure.</p>
</div>
<div class="paragraph">
<p>Under <code>demo</code> folder you can find the setup prepared to start a demo instance of Concourse and Artifactory.</p>
</div>
<div class="paragraph">
<p>In <code>docs</code> you can find HTML documentation built from contents of <code>docs-sources</code>.</p>
</div>
<div class="paragraph">
<p>The <code>src/pipeline</code> folder contains the files related to setting up pipelines in Concourse.
In <code>src/tasks</code> we&#8217;ll find all the scripts required at runtime of pipeline execution.</p>
</div>
<div class="paragraph">
<p>The <code>tools</code> folder contains tools required for building and that ease the work
with demo setup.</p>
</div>
</div>
<div class="sect2">
<h3 id="building-prerequisites"><a class="link" href="#building-prerequisites">Prerequisites</a></h3>
<div class="paragraph">
<p>As prerequisites, you need to have <a href="https://www.shellcheck.net/">shellcheck</a>,
<a href="https://github.com/sstephenson/bats">bats</a>, <a href="https://stedolan.github.io/jq/">jq</a>
and <a href="https://rubyinstaller.org/downloads/">ruby</a> installed. If you use a Linux
machine, <code>bats</code> and <code>shellcheck</code> are installed for you.</p>
</div>
<div class="paragraph">
<p>To install the required software on Linux, type the following command:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ sudo apt-get install -y ruby jq</code></pre>
</div>
</div>
</div>
</div>
<div class="paragraph">
<p>If you use a Mac, run the following commands to install the missing software:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ brew install jq
$ brew install ruby
$ brew install bats
$ brew install shellcheck</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="building-bats-submodules"><a class="link" href="#building-bats-submodules">Bats Submodules</a></h3>
<div class="paragraph">
<p>To make <code>bats</code> work properly, we needed to attach Git submodules. To have them
initialized, either clone the project or (if you have already cloned the project)
pull to update it. The following command clones the project:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ git clone --recursive https://github.com/cloudpipelines/concourse.git</code></pre>
</div>
</div>
</div>
</div>
<div class="paragraph">
<p>The following commands pull the project:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ git submodule init
$ git submodule update</code></pre>
</div>
</div>
</div>
</div>
<div class="paragraph">
<p>If you forget about this step, Gradle runs these steps for you.</p>
</div>
</div>
<div class="sect2">
<h3 id="building-build-and-test"><a class="link" href="#building-build-and-test">Build and test</a></h3>
<div class="paragraph">
<p>Once you have installed all the prerequisites, you can run the following command to build and test the project:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ ./gradlew clean build</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="building-generate-documentation"><a class="link" href="#building-generate-documentation">Generate Documentation</a></h3>
<div class="paragraph">
<p>To generate the documentation, run the following command:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ ./gradlew generateDocs</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="building-ci-worker-prerequisites"><a class="link" href="#building-ci-worker-prerequisites">CI Server Worker Prerequisites</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>Cloud Pipelines uses Bash scripts extensively. The following list shows the software
that needs to be installed on a CI server worker for the build to pass:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash"> apt-get -y install \
    bash \
    git \
    tar \
    zip \
    curl \
    ruby \
    wget \
    unzip \
    python \
    jq</code></pre>
</div>
</div>
</div>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
In the demo setup all of these libraries are already installed.
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="js/highlight/styles/atom-one-dark-reasonable.min.css">
<script src="js/highlight/highlight.min.js"></script>
<script>hljs.initHighlighting()</script>
</body>
</html>